<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 
<%@page import="com.lmpop.trade.ti_aboutchannel.*" %>
<jsp:useBean id="bean" class="com.lmpop.frame.util.RandomID" scope="page"/>
<%
	request.setCharacterEncoding("UTF-8");
	String ch_id = bean.GenTradeId();
	
	String user_id="";
	if( session.getAttribute("session_user_id") != null )
	{
		user_id = session.getAttribute("session_user_id").toString();
	}
		
	String up_ch_id = "";
	if(request.getParameter("up_ch_id") != null){
		up_ch_id = request.getParameter("up_ch_id");
	}else{
		up_ch_id = "000000000000000";
	}
	
	Ti_aboutchannelInfo ti_aboutchannelInfo = new Ti_aboutchannelInfo();
	
	String up_ch_level = "1";
	if(request.getParameter("ch_level") != null)
	{
		up_ch_level = request.getParameter( "ch_level" );
	}
	else if(up_ch_id.equals("000000000000000"))
	{
		up_ch_level = ti_aboutchannelInfo.getUpChannelLevel(up_ch_id);
		if(up_ch_level.equals("")){
			up_ch_level="1";
		}
	}
	else 
	{
		up_ch_level  = String.valueOf(Integer.parseInt(ti_aboutchannelInfo.getSelfChannelLevel(up_ch_id))+1) ;
	}
	
	
	String up_ch_name="";
	if(!up_ch_id.equals("")){
	up_ch_name = ti_aboutchannelInfo.getChName(up_ch_id);
	}
	if(up_ch_name.equals("")){
		up_ch_name="无上级栏目";
	}
	String title="新增栏目";
	if(!up_ch_name.equals("无上级栏目")){
	title="新增“"+up_ch_name+"”的下级栏目";
	}
	int count = ti_aboutchannelInfo.getCountByLevel(up_ch_level)+1;
	
%>

<html>
  <head>
    <title><%=title%></title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
	<script type="text/javascript" src="aboutchannel.js"></script>
</head>

<body>
	<h1><%=title%></h1>
	
	<form action="/doTradeReg.do" method="post" name="addForm">
	<input name="ch_id" id="ch_id" type="hidden" value="<%=ch_id%>"/>
	<input name="user_id" id="user_id" type="hidden" value="<%=user_id%>"/>
	<input name="up_ch_id" type="hidden" id="up_ch_id" value="<%=up_ch_id%>" /></td>
	<input name="ch_level" type="hidden" id="ch_level" value="<%=up_ch_level%>" /></td>
 
	<table width="100%" cellpadding="0" cellspacing="1" border="0" class="listtab">
		
		<tr>
			<td align="right" width="15%">
				栏目标识:
			</td>
			<td colspan="3"><%=ch_id%></td>
		</tr>
		
		<tr>
			<td align="right" width="15%">
				栏目名称<font color="red">*</font>
			</td>
			<td colspan="3"><input name="ch_name" id="ch_name" type="text"  maxLength="200" size="58" onkeyup= "value=value.replace(/[\uFF00-\uFFFF]/g,''); "   onbeforepaste= "clearSBC(); "/></td>
			   <tr>
					<td align="right" width="15%">
						级别:
					</td>
					<td><%=up_ch_level%></td>		 
					<td align="right" width="15%">
						排序:
					</td>
					<td>
						<input name="order_no" id="order_no" type="text" value="<%=count%>" size="5" maxlength="3" onKeyUp="if(!/^[0-9][0-9]*$/.test(this.value))this.value=''">&nbsp;( 由低 -> 高 )</td>
					</td>
				</tr> 
		</tr>	
		<tr>
			<td align="right" width="15%">
				上级栏目:
			</td>
			<td colspan="3"><%=up_ch_name%></td>
		</tr>
		
		<tr>
			<td align="right" width="15%">
				状态:
			</td>
			<td colspan="3"><input name="state" type="radio" value="0" checked />&nbsp;显示
					<input name="state" type="radio" value="1" />&nbsp;隐藏</td>
		</tr>
		
		<tr>
			<td align="right" width="15%">
				栏目类型:
			</td>
			<td colspan="3"><input name="ch_type" type="radio" value="0" checked />&nbsp;列表页栏目
				 	<input name="ch_type" type="radio" value="1" />&nbsp;详细页栏目</td>
		</tr>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td align="center">
				<input type="hidden" name="bpm_id" value="3231" />
				<input type="button" class="buttoncss" name="tradeSub" value="提交" onclick="return checkaddForm()"/>&nbsp;&nbsp;
				<input type="button" class="buttoncss" name="tradeRut" value="返回" onclick="window.location.href='index.jsp';"/>
			</td>
		</tr>
	</table>
	</form>
</body>

</html>
